************************************
******* Difference exercise ********
************************************
use ".\Dropbox\Vaccination\covid_difference.dta" // load the data

zscore(rep_* happening consensus worried conservative republican) // normalize the variables

label variable z_rep_pres "Republican presidential vote share"
label variable z_rep_house "Republican House vote share"
label variable z_conservative "Conservative population"
label variable z_republican "Republican partisanship"

**********************************
****** baseline regression *******
**********************************

//global warming is happening
reghdfe z_happening z_rep_pres, a(state_period id) cluster(statefips) 
estimates store happening_trump
reghdfe z_happening z_rep_pres z_rep_house, a(state_period id) cluster(statefips) 
estimates store happening_house

//Most scientists think global warming is happening
reghdfe z_consensus z_rep_pres, a(state_period id) cluster(statefips) 
estimates store consensus_trump
reghdfe z_consensus z_rep_pres z_rep_house, a(state_period id) cluster(statefips) 
estimates store consensus_house

//Worried about global warming
reghdfe z_worried z_rep_pres, a(state_period id) cluster(statefips) 
estimates store worried_trump
reghdfe z_worried z_rep_pres z_rep_house, a(state_period id) cluster(statefips) 
estimates store worried_house

estout happen* cons* worr* using ".\Dropbox\Vaccination\Draft\tab_difference.tex", replace style(tex) cells(b(fmt(3) star) se(par fmt(3))) stats(r2 N, fmt(2 0) labels("R-squared" "N")) keep(z_rep_pres z_rep_house) label mlabels(none) collabels(none) starlevels(* 0.10 ** 0.05 *** 0.01)

estimates clear

*************************
****** Robustness *******
*************************

reghdfe z_happening z_rep_pres z_conservative, a(state_period id) cluster(statefips) 
estimates store happening_trump
reghdfe z_happening z_rep_pres z_republican, a(state_period id) cluster(statefips) 
estimates store happening_house
reghdfe z_happening z_rep_pres z_conservative z_republican, a(state_period id) cluster(statefips) 
estimates store happening_trump2

//Most scientists think global warming is happening
reghdfe z_consensus z_rep_pres z_conservative, a(state_period id) cluster(statefips) 
estimates store consensus_trump
reghdfe z_consensus z_rep_pres z_republican, a(state_period id) cluster(statefips) 
estimates store consensus_house
reghdfe z_consensus z_rep_pres  z_conservative z_republican, a(state_period id) cluster(statefips) 
estimates store consensus_trump2

//Worried about global warming
reghdfe z_worried z_rep_pres z_conservative, a(state_period id) cluster(statefips) 
estimates store worried_trump
reghdfe z_worried z_rep_pres z_republican, a(state_period id) cluster(statefips) 
estimates store worried_house
reghdfe z_worried z_rep_pres z_conservative z_republican, a(state_period id) cluster(statefips) 
estimates store worried_trump2

estout happen* cons* worr* using ".\Dropbox\Vaccination\Draft\tab_difference_robust.tex", replace style(tex) cells(b(fmt(3) star) se(par fmt(3))) stats(r2 N, fmt(2 0) labels("R-squared" "Observations")) keep(z_rep_pres z_conservative z_republican) label mlabels(none) collabels(none) starlevels(* 0.10 ** 0.05 *** 0.01)